package com.hm.day1211.xml;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.hm.day1211.MyConfig;
@Configuration
@ImportResource(locations="classpath:app.cfg.xml")
@Import(MyConfig1.class)
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(Main.class);
				
				/*new FileSystemXmlApplicationContext("classpath:app.cfg.xml");*/

		/*Date date = context.getBean(Date.class);
		System.out.println(date);*/

	
		  Person person = context.getBean(Person.class); 
		  System.out.println(person);
		 

		Cat bean2 = context.getBean(Cat.class);
		System.out.println(bean2);

		

		Date date = (Date) context.getBean("hongkong_Back_Date");
		System.out.println(date);
		
		SimpleDateFormat bean = context.getBean(SimpleDateFormat.class);
		System.out.println(bean.format(date));
		
		Calendar bean3 = context.getBean(Calendar.class);
		System.out.println(bean3.getClass());
		
		System.out.println(context.getBean(MouMou.class));
	}
}
